<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

	<link rel="stylesheet"
		href="../../css/bootstrap.min.css" />
	<title><h:outputText value="NP Pillar" /></title>
</h:head>
<h:body>

	<ui:insert name="header">
		<ui:include src="../template/header.xhtml" />
	</ui:insert>
	<h:form id="mainForm">
		<p:panel header="Edit User">
			<p:panelGrid columns="2">
				<p:outputLabel value="User Role:" />
				<p:selectOneMenu value="#{userControler.editUser.role.id}"
					>
					<f:selectItems value="#{roleControler.baseList}" var="role"
						itemLabel="#{role.role}" itemValue="#{role.id}" />
				</p:selectOneMenu>
				<p:outputLabel value="Employee Name:" />
				<p:inputText value="#{userControler.editUser.employee.name}"
					 />

				<p:outputLabel value="User Name:" />
				<p:inputText value="#{userControler.editUser.userName}"
					/>

				<p:outputLabel value="Change Password" />
				<p:selectBooleanCheckbox value="#{userControler.changePassword}"
					>
					<p:ajax update="mainForm" />
				</p:selectBooleanCheckbox>

				<p:outputLabel value="Password:"
					rendered="#{userControler.changePassword}" />
				<p:password value="#{userControler.password}"
					rendered="#{userControler.changePassword}" />

				<p:outputLabel value="Confirm Password"
					rendered="#{userControler.changePassword}" />
				<p:password value="#{userControler.passwordConfirm}"
					rendered="#{userControler.changePassword}" />
			</p:panelGrid>
			<p:commandButton value="Save" actionListener="#{userControler.apply}"
				action="#{mainMenuControler.transfer}" onclick="blockui.show()">
				<f:setPropertyActionListener target="#{mainMenuControler.nextMenu}"
					value="/faces/admin/user.jsf" />
			</p:commandButton>
			<p:commandButton value="Cancel"
				actionListener="#{userControler.clear}" action="#{mainMenuControler.transfer}" onclick="blockui.show()">
			<f:setPropertyActionListener target="#{mainMenuControler.nextMenu}"
				value="/faces/admin/user.jsf" />
			</p:commandButton>
		</p:panel>
	</h:form>
</h:body>
</html>
